import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author : cww
 * @date : 2021/1/26 22:43
 */
public class HouseMediator extends Mediator{
    private Map<String,Colleague> colleagueList;
    public HouseMediator(){
        this.colleagueList = new HashMap<>();
    }
    @Override
    public void addColleague(Colleague colleague){
        this.colleagueList.put(colleague.getName(),colleague);
    }
    @Override
    public void send(Colleague colleague, String message) {
        for(String name:colleagueList.keySet()){
            if(name != colleague.getName()){
                colleagueList.get(name).receive(message);
            }
        }
    }
}
